﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:SL8.SL.Controls">

    <Style TargetType="local:CategorySearchItem">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:CategorySearchItem">
                    <Grid x:Name="Root" HorizontalAlignment="Stretch" Margin="3">
                        <ListBox x:Name="CategoryListBox" BorderThickness="0" BorderBrush="{x:Null}" Grid.Column="0" Grid.ColumnSpan="3" Background="Transparent" Margin="3" ItemsSource="{TemplateBinding ItemsSource}">
                            <ListBox.Template>
                                <ControlTemplate>
                                    <ItemsPresenter/>
                                </ControlTemplate>
                            </ListBox.Template>
                            <ListBox.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <StackPanel/>
                                </ItemsPanelTemplate>
                            </ListBox.ItemsPanel>
                            <ListBox.ItemContainerStyle>
                                <Style TargetType="ListBoxItem">
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate>
                                                <ContentPresenter/>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </ListBox.ItemContainerStyle>
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <Grid Margin="3">
                                        <CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" Content="{Binding Description}"/>
                                    </Grid>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
